package com.hnucm.c202001020214;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.gyf.immersionbar.ImmersionBar;
import com.hnucm.c202001020214.object.Book;

import java.util.ArrayList;
import java.util.List;

public class Electronics extends BaseActivity {
    public List<Book> bookList = new ArrayList<>();
    RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_electronics);
        ImmersionBar.with(this)
                // .statusBarColor(R.color.touming)
                .init();

        recyclerView =findViewById(R.id.recyclerview);
        LinearLayoutManager layoutManager = new LinearLayoutManager(Electronics.this);
        recyclerView.setLayoutManager(layoutManager);

        BookAdapter adapter = new BookAdapter(bookList);
        recyclerView.setAdapter(adapter);
        initElectronics();

    }

    public void initElectronics(){
        Book book01 = new Book(R.drawable.e_01,"联想笔记本（白）","1999.99元");
        bookList.add(book01);
        Book book02 = new Book(R.drawable.e_02,"华为平板","999.99元");
        bookList.add(book02);
        Book book03 = new Book(R.drawable.e_03,"二手鼠标","28.00元");
        bookList.add(book03);
        Book book04 = new Book(R.drawable.e_04,"二手显示器","156.00元");
        bookList.add(book04);
        Book book05 = new Book(R.drawable.e_05,"散热器","99.00元");
        bookList.add(book05);
        Book book06 = new Book(R.drawable.e_06,"联想笔记本（黑）","1999.99元");
        bookList.add(book06);
        Book book08 = new Book(R.drawable.e_07,"iPhone","1799.00元");
        bookList.add(book08);
        Book book09 = new Book(R.drawable.e_08,"二手键鼠","56.00元");
        bookList.add(book09);
        Book book10 = new Book(R.drawable.e_09,"四级听力耳机","156.00元");
        bookList.add(book10);
    }
}